package cn.yitun.chat.yitunserverfilecore.util;

import cn.yitun.chat.yituncommonutil.YitunDateUtil;
import cn.yitun.chat.yituncommonutil.YitunStringUtil;

/**
 * @author yitun
 * @date 2017-11-24 22:52:39
 */
public class FilePathUtil {

	/**
	 * 获取根目录
	 * 
	 * @param rootPath
	 * @return
	 */
	public static StringBuilder getRootPath(String rootPath) {
		StringBuilder root = new StringBuilder();
		return root.append((YitunStringUtil.isNotEmpty(rootPath)) ? rootPath : "");
	}

	public static String getNodePath() {
		return getNodePath("");
	}

	public static String getNodePath(String basePath) {
		StringBuilder nodePath = new StringBuilder(basePath);
		nodePath.append(YitunDateUtil.getCurrentYear());
		nodePath.append("/");
		nodePath.append(YitunDateUtil.getCurrentMonth());
		nodePath.append("/");
		nodePath.append(YitunDateUtil.getCurrentDay());
		nodePath.append("/");
		return nodePath.toString();
	}
}
